<template>
  <div
    class="quota-item"
    :data-bill_id="accountItem.bill_id"
    @click="$emit('quota-item', accountItem.bill_id)"
  >
    <div class="quota-top">
      <div class="quota-item-left">
        <p class="left-title">{{accountItem.user_name}}</p>
        <p>{{dateFormat(accountItem.addtime)}}</p>
      </div>
      <div class="quota-item-right">
        <p class="right-title">{{accountItem.apply_amount}} {{accountItem.currency_code}}</p>
        <p>{{accountItem.status | showQuotaStatus}}</p>
      </div>
    </div>
    <div class="quota-bottom" v-if="accountItem.status==0">
      <div class="quota-bottom-right" @click="agree(accountItem.bill_id,'agree')">
        <p>同意</p>
      </div>
      <div class="quota-bottom-left" @click="rejected(accountItem.bill_id,'reject')">
        <p>驳回</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    accountItem: Object
  },
  data: function() {
    return {};
  },
  computed: {},
  methods: {
    dateFormat(addtime) {
      return this.$utils.dateFormat(addtime);
    },
    accountItemClick(e) {},
    rejected(bill_id, type) {
      this.$router.push({
        path: "/credit/reject",
        query: { bill_id: bill_id, from: "leshell" }
      });
    },
    agree(bill_id, type) {
      this.$router.push({
        path: "/credit/argee",
        query: { bill_id: bill_id, from: "leshell" }
      });
    }
  },
  filters: {
    showQuotaStatus: function(value) {
      //0提交申请，-1已驳回，1已同意，-2取消申请
      if (!value) return "";
      let str = "";
      switch (value) {
        case "0":
          str = "提交申请";
          break;
        case "-1":
          str = "已驳回";
          break;
        case "1":
          str = "已同意";
          break;
        case "-2":
          str = "取消申请";
          break;
        default:
          str = "提交申请";
      }
      return str;
    }
  }
};
</script>

<style scoped>
.quota-item {
  line-height: 1;
  width: 690px;
  margin-top: 20px;
  margin-left: 30px;
  background-color: #fff;
  border: 2px solid rgb(237, 238, 240);
  border-radius: 8px;
  border-bottom: none;
}
.quota-top {
  height: 112px;
  border-bottom: 2px solid #ededf0;
}
.quota-item-left {
  float: left;
  margin-top: 24px;
  margin-left: 30px;
}
.quota-item-left .left-title {
  font-family: "PingFangSC-Medium";
  margin-top: 0px;
  font-size: 28px;
  color: rgb(41, 41, 41);
}
.quota-item-left p {
  margin-top: 20px;
  font-family: "Helvetica-Regular";
  font-size: 24px;
  color: rgb(153, 153, 153);
}
.quota-item-right {
  float: right;
  margin-right: 30px;
  text-align: right;
}
.quota-item-right .right-title {
  margin-top: 24px;
  font-family: "SFUIDisplay-Medium";
  font-size: 28px;
  color: rgb(51, 51, 51);
}
.quota-item-right p {
  margin-top: 20px;
  font-family: "PingFangSC-Regular";
  font-size: 24px;
  color: rgb(211, 155, 0);
}
.quota-bottom {
  text-align: center;
  line-height: 60px;
  overflow: hidden;
  padding-bottom: 20px;
  border-bottom: 2px solid rgb(237, 238, 240);
}
.quota-bottom-left {
  float: right;
  margin-top: 16px;
  margin-right: 20px;
  width: 150px;
  height: 60px;
  border: 2px solid rgb(192, 195, 204);
  border-radius: 30px;
}
.quota-bottom-left p {
  font-family: "PingFangSC-Regular";
  font-size: 28px;
  color: rgb(102, 102, 102);
}
.quota-bottom-right {
  float: right;
  margin-top: 16px;
  margin-right: 30px;
  width: 150px;
  height: 60px;
  border: 2px solid #2086f9;
  border-radius: 30px;
}
.quota-bottom-right p {
  font-family: "PingFangSC-Regular";
  font-size: 28px;
  color: rgb(32, 134, 249);
}
</style>
